-
Notifications
You must be signed in to change notification settings - Fork 923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add priorityClassName in PropagationPolicy & ClusterPropagationPolicy #5962
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #5962 +/- ##
==========================================
- Coverage 48.12% 48.10% -0.02%
==========================================
Files 668 668
Lines 55291 55291
==========================================
- Hits 26607 26599 -8
- Misses 26949 26956 +7
- Partials 1735 1736 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
2d81d50
to
25e0f40
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/assign
Start working on it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whitewindmills Would you like to take another look?
// SchedulePriority defines how Karmada should resolve the priority and preemption policy | ||
// for workload scheduling. | ||
// | ||
// Valid options for PriorityClassSource are: | ||
// - KubePriorityClass (default): Uses Kubernetes PriorityClass (scheduling.k8s.io/v1) | ||
// - PodPriorityClass: Uses PriorityClassName from PodTemplate (PodSpec.PriorityClassName) | ||
// - FederatedPriorityClass: Uses Karmada FederatedPriorityClass (not yet implemented) | ||
// | ||
// PriorityClassName behavior: | ||
// | ||
// For KubePriorityClass: | ||
// - If specified: Uses the named Kubernetes PriorityClass | ||
// - If empty: Uses cluster's global default PriorityClass | ||
// - If neither exists: Sets priority=0 and preemptionPolicy=Never | ||
// | ||
// For PodPriorityClass: | ||
// - Uses PriorityClassName from PodTemplate | ||
// - Falls back to global default if not found | ||
// - If no valid PriorityClass found: Sets priority=0 and preemptionPolicy=Never | ||
// | ||
// For FederatedPriorityClass: | ||
// - Reserved for future use | ||
// - Current behavior undefined | ||
// | ||
// +optional | ||
SchedulePriority *SchedulePriority `json:"schedulePriority,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we don't have to explain the valid options outside, because they are described inside of SchedulePriority
. But we can give some overall descriptions, like:
// SchedulePriority defines how Karmada should resolve the priority and preemption policy | |
// for workload scheduling. | |
// | |
// Valid options for PriorityClassSource are: | |
// - KubePriorityClass (default): Uses Kubernetes PriorityClass (scheduling.k8s.io/v1) | |
// - PodPriorityClass: Uses PriorityClassName from PodTemplate (PodSpec.PriorityClassName) | |
// - FederatedPriorityClass: Uses Karmada FederatedPriorityClass (not yet implemented) | |
// | |
// PriorityClassName behavior: | |
// | |
// For KubePriorityClass: | |
// - If specified: Uses the named Kubernetes PriorityClass | |
// - If empty: Uses cluster's global default PriorityClass | |
// - If neither exists: Sets priority=0 and preemptionPolicy=Never | |
// | |
// For PodPriorityClass: | |
// - Uses PriorityClassName from PodTemplate | |
// - Falls back to global default if not found | |
// - If no valid PriorityClass found: Sets priority=0 and preemptionPolicy=Never | |
// | |
// For FederatedPriorityClass: | |
// - Reserved for future use | |
// - Current behavior undefined | |
// | |
// +optional | |
SchedulePriority *SchedulePriority `json:"schedulePriority,omitempty"` | |
// SchedulePriority defines how Karmada should resolve the priority and preemption policy | |
// for workload scheduling. | |
// | |
// This setting is particularly useful for controlling the scheduling behavior of offline workloads. | |
// By setting a higher or lower priority, users can control which workloads are scheduled first. | |
// Additionally, it also allows to specify the preempt policy that higher-priority workloads can | |
// preempt lower-priority ones in scenarios where resource contention occurs. | |
// | |
// Note: This feature is currently in the alpha stage. The priority-based scheduling functionality is | |
// controlled by the PriorityBasedScheduling feature gate, and preemption is controlled by the | |
// PriorityBasedPreemptiveScheduling feature gate. At this time, only priority-based scheduling is | |
// supported, while preemption functionality is not yet available and will be introduced in the future | |
// releases as the feature matures. | |
// | |
// +optional | |
SchedulePriority *SchedulePriority `json:"schedulePriority,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated.
// - KubePriorityClass (default): Uses Kubernetes PriorityClass (scheduling.k8s.io/v1) | ||
// - PodPriorityClass: Uses PriorityClassName from PodTemplate (PodSpec.PriorityClassName) | ||
// - FederatedPriorityClass: Uses Karmada FederatedPriorityClass (not yet implemented) | ||
// | ||
// +kubebuilder:default="KubePriorityClass" | ||
// +kubebuilder:validation:Enum=FederatedPriorityClass;KubePriorityClass;PodPriorityClass | ||
// +optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, we provide support for KubePriorityClass
only, right?
Shall we add a comment to PodPriorityClass
to explain a little bit, something like not yet implemented
?
In addition, please shorten the +kubebuilder:validation:Enum
with supported options.
// - Reserved for future use | ||
// - Current behavior undefined | ||
// | ||
// +optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// +optional | |
// +required |
Can we restrict this as a required in the current version, just hope to work out a simple version quickly.
@seanlaii In your use cases, will you set a specific PriorityClassName for each workload, or will you rely on the default one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we currently set a default priority class for every workload if no priority class is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we currently set a default priority class for every workload if no priority class is set.
+1
I think that making the configuration clearer, and also a relief for the implementation.
/assign |
// | ||
// For PodPriorityClass: | ||
// - Uses PriorityClassName from PodTemplate | ||
// - Falls back to global default if not found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid people don't know what the global default is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the description to
// If the specified PriorityClass is not found, falls back to the cluster's default PriorityClass
// (i.e., the PriorityClass marked as the global default in the cluster).
WDYT?
Signed-off-by: wei-chenglai <[email protected]>
25e0f40
to
4bf165a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
I'm going to move this forward to avoid blocking the other tasks.
And I'll double check the comments before releasing, ensuring the comments consist with the minimal version.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind api-change
/kind feature
What this PR does / why we need it:
Add SchedulePriority to PropagationPolicy & ClusterPropagationPolicy to support flexible priority class resolution strategies:
This enhancement allows users to:
Which issue(s) this PR fixes:
Part of #5961
Special notes for your reviewer:
Does this PR introduce a user-facing change?: